#!/bin/sh
zippage_enfry()
{
	cd  /home/enfry/tomcat_$tomcatNum/wtpwebapps/
	if [ $tomcatNum  -eq 1 ]; then
	rm -rf e.zip
	zip -r e.zip e
	elif [ $tomcatNum  -eq 2 ]; then
	rm -rf g.zip
	zip -r g.zip g
	fi
	
	if [ $? -eq 0 ];then
		echo "===tomcat_$tomcatNum==打包成功"
	else
		echo "===tomcat_$tomcatNum==打包失败"
	fi
}

zippage_all_enfry()
{
	cd  /home/enfry/tomcat_1/wtpwebapps/
	rm -rf e.zip
	zip -r e.zip e
	cd  /home/enfry/tomcat_2/wtpwebapps/
	rm -rf g.zip
	zip -r g.zip g
	
	
	if [ $? -eq 0 ];then
		echo "===tomcat_$tomcatNum==打包成功"
	else
		echo "===tomcat_$tomcatNum==打包失败"
	fi
}



echo "首先=======================选择打包的项目===================================================="
echo "请按照如下提示选择打包的项目："
echo "0:表示EN+和GATEWAY"
echo "1:表示EN+"
echo "2:表示GATEWAY"
read -p "请输入本次要打包的项目:" tomcatNum
if [ ! $tomcatNum ]; then 
echo "输入错误，请重新执行"
else
	if [ $tomcatNum  -eq 0 ]; then
	echo "当前打包的项目为：EN+和GATEWAY"
	zippage_all_enfry
	elif [ $tomcatNum  -eq 1 ]; then
	echo "当前打包的项目为：EN+"
	zippage_enfry
	elif [ $tomcatNum  -eq 2 ]; then
	echo "当前打包的项目为：GATEWAY"
	zippage_enfry
	else
	echo "用户选择错误，请重新执行===================="
	fi
fi